import tkinter as tk
import time
import threading           #多线程

def tloop():
    time.sleep(5)
    root.destroy()

root = tk.Tk()   
root.geometry('400x400')
tag=tk.Label(root,text='5秒后关闭')
tag.pack()
f=threading.Thread(target=tloop)
f.start()
root.mainloop()

time.sleep(5)

root = tk.Tk()   
root.geometry('400x400')
tag=tk.Label(root,text='你好')
tag.pack()

root.mainloop()




